package com.kins.executer.utils;

import com.kins.executer.constants.Constant;
import com.kins.executer.vo.MappingParamVo;

import java.util.concurrent.Executors;

/**
 * @Description:
 * @Author: 申科
 * @Date:2025/11/12 11:09
 */

public class ParamLogUtils {
    /**
     * 获取错误日志信息，拼接日志信息
     */
    public static String createLogInfo(MappingParamVo vo, Object obj){
        StringBuffer sb = new StringBuffer();
        sb.append(BaseParamEnum.SERVICE_ARRANGE_ID.getName() + Constant.COLON)
                .append(vo.getServiceArrangeId()).append(Constant.COMMA);
        sb.append(BaseParamEnum.SERVICE_ARRANGE_VERSION.getName() + Constant.COLON)
                .append(vo.getServiceArrangeVersion()).append(Constant.COMMA);
        sb.append(BaseParamEnum.NODE_ID.getName() + Constant.COLON)
                .append(vo.getNodeId()).append(Constant.COMMA);
        sb.append(BaseParamEnum.INTERFACE_ID.getName() + Constant.COLON)
                .append(vo.getInterfaceId()).append(Constant.COMMA);
        sb.append(BaseParamEnum.INTERFACE_VERSION.getName() + Constant.COLON)
                .append(vo.getInterfaceVersion()).append(Constant.COMMA);
        sb.append(BaseParamEnum.INTERFACE_TYPE.getName() + Constant.COLON)
                .append(vo.getInterfaceType()).append(Constant.COMMA);
        if(obj instanceof Exception){
            Exception e = (Exception) obj;
            sb.append(Constant.RUN_ERROR + e.getMessage());
        }else {
            sb.append(obj);
        }
        return sb.toString();
    }
}
